package com.ngc.mall.common.configure.response;

public enum ResponseCode {

    SUCCESS(ResponseCode.SUCCESS_CODE,"请求数据成功"),
    UNKNOWN(ResponseCode.SYSTEM_ERROR_CODE, "未知错误"),

    PERMISSION_NO_ACCESS("无访问权限"),

    LOGIN_PASSWORD_ERROR(20004,"密码错误或账号不存在"),
    /**
     * 用户未登录
     */
    USER_NOT_LOGGED_IN(ResponseCode.LOGIN_EXPIRED_CODE, "登录信息已过期"),

    USER_SIGNED(80001,"用户今日已签到"),

    INTEGRAL_LACK(80004,"总积分不足以扣减"),

    INTEGRAL_TASK_NOT_EXIST(80006,"积分任务不存在"),

    INTEGRAL_TASK_COMPLETED(80007,"积分任务已完成"),

    FAILURE(20002, "失败"),

    /**
     * 添加附件失败
     */
    ATTACHMENT_INSERT_FAIL(60035,"添加附件失败"),

    /**
     * 优惠券不存在
     */
    COUPON_NOT_EXIST(40006,"优惠券不存在"),

    /**
     * 用户已领取该优惠券
     */
    USER_COUPON_EXISTED(40007,"用户已领取该优惠券"),

    USER_COUPON_NOT_EXIST(50004,"用户不存在该优惠券"),
    /**
     * 优惠券不合法
     */
    COUPON_ERROR(40007,"优惠券不合法"),

    /**
     * 优惠券已过期
     */
    COUPON_EXPIRED(40007,"优惠券已过期"),

    /**
     * 重复领取优惠券
     */
    COUPON_REPEAT(40008,"重复领取优惠券"),

    /**
     * 订单不存在
     */
    ORDER_NO_EXIST(60001,"订单不存在");



    /**
     * 登录已过期
     */
    private static final int LOGIN_EXPIRED_CODE = 20001;


    /**
     * 请求成功
     */
    private static final int SUCCESS_CODE=20000;


    public static final int FAILURE_CODE = 30000;

    /**
     * 未知错误
     */
    private static final int SYSTEM_ERROR_CODE=-1;

    private final Integer code;
    private final String message;

    ResponseCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    ResponseCode(String message) {
        this(ResponseCode.FAILURE_CODE, message);
    }

    public Integer code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }
}
